<?php
/*
 *  A Part of snock project
 *   Author king-of-war
 * Last modified 2009-4-21
 *
 */
 @session_start();
 echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';

 $root_path='../';
 include_once $root_path.'admin/smarty_config.php';
include_once $root_path.'admin/class/error.class.php';
include_once $root_path.'admin/class/sort.class.php';
$error=new Errmsg();
$sort= new sort($root_path);
/*
 *
 * check identify
 */
include_once $root_path.'admin/class/verify.class.php';
$a=new verify($root_path);
$a->identity_check(3);


/*
 * check the id which has been choosed or none
 */

if($_GET['id']!=''){
$id=$_GET['id'];
}else{
$info='请选择要编辑的产品分类';
$error->error_chinese($info);
exit;
}
/*
 * get the commnets by id
 */
$pass=$sort->sort_read($id);
$sorts= array();
$sorts['name']=$pass[0]->get_name();
$sorts['intro']=$pass[0]->get_intro();
/*
 *  define update moudle
 * fun 1 means add sort 0 means update
 */

 if(isset($_POST['submit'])){
	$id=$id;
 	$name=$_POST['title'];
 	$intro=$_POST['intro'];
 $line=$sort->sort_add($id,$name,$intro,0);
if($line){
	$info='产品分类更新成功';
$error->error_chinese($info);
exit;
}else{
$info='产品分类更新失败';
$error->error_chinese($info);
exit;
}
 }
$smarty->assign('sorts',$sorts);
$smarty->display("sort_update.html");


?>
